import {useState} from 'react'
export  function useCount(n=0){
  const [count,setCount] = useState(n)
  function set(v){
    setCount(v);
  }
  function reset(){
    setCount(n)
  }
  function inc(v=1){
    setCount(count+v)
  }
  function dec(v=-1){
    setCount(count+v)
  }
  return {count,inc,dec,set,reset};
}